<?php/*  PHP version 5  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220*/


namespace inc_application\link;

use application\ESPCMS_Core;

class PublicLink {

	public static function get_link($lng, $linkcode = false) {
		global $espcms_command;
		$url = $espcms_command['HTTP_PATHTYPE'] ? espcms_host('RT') : espcms_host('AP');
		if (ESPCMS_ISADMIN && defined('ESPCMS_ISADMIN')) {
			$url = str_replace(ESPCMS_ADMIN_DIRNAME . '/', '', $url);
		}
		if (ESPCMS_WEB_LAN && defined('ESPCMS_WEB_LAN')) {
			$lng_code = ESPCMS_WEB_LAN;
		} else {
			$lng_code = ESPCMS_CREAT && defined('ESPCMS_CREAT') ? ESPCMS_CREAT : $lng;
		}
		if ($lng_code) {
			$lan_read = ESPCMS_Core::get_lan_view($lng_code);
			$lan_dirname = $lan_read['ispack'] && $lan_read['packname'] ? $lan_read['packname'] : $lan_read['lng'];
			$creat_html_dir = $espcms_command['FILE_HTMLDIR'] && $espcms_command['IS_HTMLDIR'] ? $espcms_command['FILE_HTMLDIR'] : '';
			$url = str_replace($creat_html_dir . $lan_dirname . '/', '', $url);
			$file_path = $espcms_command['HOME_LNG'] == $lng_code ? '' : $creat_html_dir . $lan_dirname . '/';
			if (ESPCMS_WEB_TYPE != 'WAP') {
				$url = $url . $file_path;
			}
		}
		$link_array = array();
		$link_array['home'] = $url;
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}

	public static function get_verfication($linkcode = false) {
		$link_array = array();
		$action_key_join['ac'] = 'VerificationCode';
		$action_key_join['at'] = 'Verfiout';
		$link_array['seccodelink'] = espcms_url_out($action_key_join);
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}

	public static function get_fileupload($linkcode = false, $read = array()) {
		$link_array = array();
		$action_key_join['ac'] = 'FileUpload';
		$action_key_join['at'] = 'FileUpload';
		$action_key_join['inputidname'] = $read['attrname'];
		$action_key_join['upFileType'] = $read['inputtype'];
		$link_array['uploadlink'] = espcms_url_out($action_key_join);
		$action_key_join['at'] = 'FileSave';
		$action_key_join['inputidname'] = $read['attrname'];
		$action_key_join['upFileType'] = $read['inputtype'];
		$link_array['upfiesave'] = espcms_url_out($action_key_join);
		return $linkcode ? $link_array[$linkcode] : $link_array;
	}

}
